package com.devilvan.betrice.recruitment.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.*;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Evad.Wu
 * @Description Boss直聘采集信息 映射对象
 * @date 2022-08-06
 */
@Setter
@Getter
@NoArgsConstructor
@Accessors(chain = true)
@ToString(exclude = {"skills", "welfares", "labels"})
@EqualsAndHashCode(callSuper = true, exclude = {"skills", "welfares", "labels"})
@TableName(value = "BOSS_JOB")

@Entity
@Table(name = "BOSS_JOB")
@DynamicInsert
@DynamicUpdate
@Schema(description = "Boss直聘采集信息 映射对象")
public class BossJobPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 25165575887353086L;
    @Schema(description = "企业ID")
    @Column(name = "BRAND_ID")
    @TableField(value = "BRAND_ID")
    private String brandId;
    @Schema(description = "企业名称")
    @Column(name = "BRAND_NAME")
    @TableField(value = "BRAND_NAME")
    private String brandName;
    @Schema(description = "企业LOGO网址")
    @Column(name = "BRAND_LOGO")
    @TableField(value = "BRAND_LOGO")
    private String brandLogo;
    @Schema(description = "融资状态")
    @Column(name = "BRAND_STAGE_NAME")
    @TableField(value = "BRAND_STAGE_NAME")
    private String brandStageName;
    @Schema(description = "从事领域")
    @Column(name = "BRAND_INDUSTRY")
    @TableField(value = "BRAND_INDUSTRY")
    private String brandIndustry;
    @Schema(description = "人员规模")
    @Column(name = "BRAND_SCALE_NAME")
    @TableField(value = "BRAND_SCALE_NAME")
    private String brandScaleName;
    @Schema(description = "期望岗位ID")
    @Column(name = "EXPECT_ID")
    @TableField(value = "EXPECT_ID")
    private String expectId;
    @Schema(description = "岗位ID")
    @Column(name = "JOB_ID")
    @TableField(value = "JOB_ID")
    private String jobId;
    @Schema(description = "岗位名称")
    @Column(name = "JOB_NAME")
    @TableField(value = "JOB_NAME")
    private String jobName;
    @Schema(description = "薪资待遇描述")
    @Column(name = "SALARY_DESC")
    @TableField(value = "SALARY_DESC")
    private String salaryDesc;
    @Schema(description = "经验要求")
    @Column(name = "JOB_EXPERIENCE")
    @TableField(value = "JOB_EXPERIENCE")
    private String jobExperience;
    @Schema(description = "学历要求")
    @Column(name = "JOB_DEGREE")
    @TableField(value = "JOB_DEGREE")
    private String jobDegree;
    @Schema(description = "所在城市")
    @Column(name = "CITY_NAME")
    @TableField(value = "CITY_NAME")
    private String cityName;
    @Schema(description = "所在区域")
    @Column(name = "AREA_DISTRICT")
    @TableField(value = "AREA_DISTRICT")
    private String areaDistrict;
    @Schema(description = "办公区域")
    @Column(name = "BUSSINESS_DISTRICT")
    @TableField(value = "BUSSINESS_DISTRICT")
    private String businessDistrict;
    @Schema(description = "招聘人ID")
    @Column(name = "BOSS_ID")
    @TableField(value = "BOSS_ID")
    private String bossId;
    @Schema(description = "招聘人姓名")
    @Column(name = "BOSS_NAME")
    @TableField(value = "BOSS_NAME")
    private String bossName;
    @Schema(description = "招聘人职位")
    @Column(name = "BOSS_TITLE")
    @TableField(value = "BOSS_TITLE")
    private String bossTitle;

    @Schema(description = "要求技能")
    @TableField(exist = false)
    @ManyToMany(targetEntity = BossSkillPo.class,
            cascade = CascadeType.MERGE,
            fetch = FetchType.LAZY)
    @JoinTable(name = "BOSS_JOB_RLT_SKILL",
            joinColumns = {@JoinColumn(name = "BOSS_JOB_ID", referencedColumnName = "ID")},
            inverseJoinColumns = {@JoinColumn(name = "BOSS_SKILL_ID", referencedColumnName = "ID")})
    @Fetch(value = FetchMode.SUBSELECT)
    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    private Set<BossSkillPo> skills = new HashSet<>(0);
    @Schema(description = "福利待遇")
    @TableField(exist = false)
    @ManyToMany(targetEntity = BossWelfarePo.class,
            cascade = CascadeType.MERGE,
            fetch = FetchType.LAZY)
    @JoinTable(name = "BOSS_JOB_RLT_WELFARE",
            joinColumns = {@JoinColumn(name = "BOSS_JOB_ID", referencedColumnName = "ID")},
            inverseJoinColumns = {@JoinColumn(name = "BOSS_WELFARE_ID", referencedColumnName = "ID")})
    @Fetch(value = FetchMode.SUBSELECT)
    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    private Set<BossWelfarePo> welfares = new HashSet<>(0);
    @Schema(description = "任职要求")
    @TableField(exist = false)
    @ManyToMany(targetEntity = BossLabelPo.class,
            cascade = CascadeType.MERGE,
            fetch = FetchType.LAZY)
    @JoinTable(name = "BOSS_JOB_RLT_LABEL",
            joinColumns = {@JoinColumn(name = "BOSS_JOB_ID", referencedColumnName = "ID")},
            inverseJoinColumns = {@JoinColumn(name = "BOSS_LABEL_ID", referencedColumnName = "ID")})
    @Fetch(value = FetchMode.SUBSELECT)
    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    private Set<BossLabelPo> labels = new HashSet<>(0);

}
